package com.mvpandroiddemo.net;

import com.mvpandroiddemo.utils.Constance;
import com.mvpandroiddemo.utils.SharedPreferenceHelper;
import com.orhanobut.logger.Logger;

import java.io.IOException;
import java.util.List;

import okhttp3.Interceptor;
import okhttp3.Response;

/**
 * @Description $description$
 * @Author owner
 * @CreateTime 2019/10/17 17:11
 **/
public class ReceivedCookiesInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Response response = chain.proceed(chain.request());
//
//        StringBuilder stringBuilder = new StringBuilder();
//        List<String> header = response.headers("Set-Cookie");
//        for (int i = 0; i < header.size(); i++) {
//            String s = header.get(i);
//            stringBuilder.append(s);
//        }
//        String value = stringBuilder.toString();
//        SharedPreferenceHelper.getInstance().saveData(Constance.Cache_cookie, value);
//        Logger.e("收到的cookie +> " + value);

        return response;
    }
}
